﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Linq.Expressions;
using SBACN.WebSite.Models;
using SBACN.WebSite.Code;

namespace SBACN.WebSite.ContentDL
{
	public partial class PolicyDetail : MemberBasePage
	{
		protected string Img { get; set; }
		protected void Page_Load(object sender, EventArgs e)
		{
			BindData(Request.QueryString["id"]);
			ImgData();
		}

		protected void BindData(string id)
		{
			int ID = Convert.ToInt32(id);
			Expression<Func<TB_News, bool>> f = (p => p.ID == ID);

			var resultQ = DAL.DALHelper.Instance.GetList<TB_News>(f);

			this.Policy.DataSource = resultQ;
			this.Policy.DataBind();

		}

		protected void ImgData()
		{
			string type;
			if (string.IsNullOrWhiteSpace(Request.QueryString["code"]))
			{
				type = "";
			}
			else
			{
				type = this.SystemCode;
			}
			Expression<Func<TB_SystemConfig, bool>> f = (p => p.Code == "Img" && p.Type == type);
			var resultQ = DAL.DALHelper.Instance.GetFirstOrDefaultObject<TB_SystemConfig>(f);
			if (resultQ != null)
			{
				this.Img = resultQ.Value.ToString();
			}
		}

	}

}